import {
    RECORD_ADDRESS,
    ADD_CART,
    REDUCE_CART,
    INIT_BUYCART,
    CLEAR_CART,
    RECORD_SHOPDETAIL,
    RECORD_USERINFO,
    GET_USERINFO,
    CONFIRM_REMARK,
    CONFIRM_INVOICE,
    CHOOSE_SEARCH_ADDRESS,
    SAVE_GEOHASH,
    CONFIRM_ADDRESS,
    CHOOSE_ADDRESS,
    NEED_VALIDATION,
    SAVE_CART_ID_SIG,
    SAVE_ORDER_PARAM,
    CHANGE_ORDER_PARAM,
    ORDER_SUCCESS,
    SAVE_SHOPID,
    SAVE_ORDER,
    OUT_LOGIN,
    RETSET_NAME,
    SAVE_AVANDER,
    SAVE_ADDRESS,
    SAVE_ADDDETAIL,
    SAVE_QUESTION,
    ADD_ADDRESS,
    BUY_CART,
} from './mutation-types.js'

import storage from '../utils/until';
export default {
    // 记录用户信息
    [RECORD_USERINFO](state, info) {
        state.userInfo = info;
        storage.setItem('user', info.user);
        storage.setItem('loginState', info.loginState);
    },

    //退出登录
    [OUT_LOGIN](state) {
        state.userInfo = {};
        state.loginState = false;
    },
    
    /* 
        可以使用[key]的方式定义
    */
    increment(state) {
        return state.count++
    },
    setValue(state, value) {
        state.passValue = value;
    },
    console() {
        console.log('这里触发的是异步的方法')
    }

}
